﻿<%@ Page Title="POSSystem | Customer Requests" Theme="POSSystem" Language="C#" MasterPageFile="~/Application.Master"
    AutoEventWireup="true" CodeBehind="CustomerRequest.aspx.cs" Inherits="WebUI.CustomerRequest" %>

<%@ Register Src="~/Controls/SysControls/PageHeader.ascx" TagPrefix="uc" TagName="PageHeader" %>
<%@ Register Src="~/Controls/POSControls/CustomerRequestsCtrl.ascx" TagName="CustomerRequests"
    TagPrefix="uc" %>
<%@ Register Src="~/Controls/POSControls/RequestContent.ascx" TagName="RequestContent"
    TagPrefix="uc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ApplicationHeadHolder" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ApplicationContentHolder" runat="server">
    <script type="text/javascript">
        function loadByRequestID() {
            var ids = getSelectedItemID<%= gridRequests.ClientID %>();
            var hidRequestID = document.getElementById("<%= hidRequestID.ClientID %>");
            var btnLoadByRequestID = document.getElementById("<%=btnLoadByRequestID.ClientID %>");
   
            hidRequestID.value = ids;
            btnLoadByRequestID.click();
        }

        function onSelect() {
            var id = getSelectedItemID<%=gridRequests.ClientID %>();
            if(id == null){
                alert("No item was selected!");
                return false;
            }
            return true;
        }
    </script>
    <uc:PageHeader ID="pageHeader" Text="Customer Requests" ImageURL="~/Images/email-icon.gif"
        runat="server" />
    <table width="100%">
        <tr>
            <td style="width: 35%; text-align: left; vertical-align: top">
                <asp:Panel ID="panelCategory" runat="server" class="primaryPanel">
                    <div class="titleBar">
                        <asp:Label ID="lblTitle1" runat="server" CssClass="titleContent">Request List</asp:Label>
                    </div>
                    <div class="primaryFrameNoBorder">
                        <asp:UpdatePanel ID="updateSearch" runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                                <table width="100%" class="toolbar">
                                    <tr>
                                        
                                            <td style='vertical-align: top; text-align: left; width: 255px'>
                                                <asp:Panel ID="Panel1" runat="server" DefaultButton="LinkButton1">
                                                    <asp:Label ID="label10" runat="server" Text="Instant Search"></asp:Label>
                                                    <asp:TextBox ID="txtSearch" runat="server"></asp:TextBox>
                                                    <asp:LinkButton class="tbbutton" ID="LinkButton1" runat="server" OnClick="btnSearch_OnClick" Visible="false">
                                                    </asp:LinkButton>
                                                </asp:Panel>
                                            </td>
                                            <td style='vertical-align: top; text-align: left; width: 20px'>
                                                <asp:LinkButton class="tbbutton" ID="btnSearch" runat="server" OnClick="btnSearch_OnClick">
                                                    <img src="Images/search.png"/>
                                                </asp:LinkButton>
                                            </td>
                                        
                                        <td style='vertical-align: top; text-align: left; width: 250px'>
                                            <asp:Label ID="label1" runat="server" Text="Sort by"></asp:Label>
                                            <asp:DropDownList ID="ddlSort" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlSort_Changed">
                                                <asp:ListItem Text="Sent Date" Value="CreatedDate"></asp:ListItem>
                                                <asp:ListItem Text="Requestor" Value="Requestor"></asp:ListItem>
                                                <asp:ListItem Text="Subject" Value="Title"></asp:ListItem>
                                            </asp:DropDownList>
                                            <asp:DropDownList ID="ddlSortDirection" AutoPostBack="true" runat="server" OnSelectedIndexChanged="ddlSort_Changed">
                                                <asp:ListItem Text="Descending" Value=" desc"></asp:ListItem>
                                                <asp:ListItem Text="Ascending" Value=" asc"></asp:ListItem>
                                            </asp:DropDownList>
                                        </td>
                                        <td style='vertical-align: top; text-align: left'>
                                            <img src="Images/tbSep.png" />
                                            <asp:LinkButton class="tbbutton" ID="btnImportant" runat="server" OnClick="btnImportant_OnClick"
                                                OnClientClick="return onSelect();">
                                                <img src="Images/Important.png" /><asp:Label ID="label8" runat="server" Text="Important"
                                                    ToolTip="Mark/Unmark as important"></asp:Label>
                                            </asp:LinkButton>
                                            <asp:LinkButton class="tbbutton" ID="btnUnread" runat="server" OnClick="btnUnread_OnClick"
                                                OnClientClick="return onSelect();">
                                                <img src="Images/flag.png" /><asp:Label ID="label2" runat="server" Text="Unread"
                                                    ToolTip="Mark/Unmark as unread"></asp:Label>
                                            </asp:LinkButton>
                                        </td>
                                    </tr>
                                </table>
                                <table width="100%" style="border: 1px solid grey">
                                    <tr>
                                        <td style="width: 350px; vertical-align: top">
                                            <asp:UpdatePanel ID="updateList" runat="server" UpdateMode="Conditional">
                                                <ContentTemplate>
                                                    <uc:CustomerRequests Width="350px" AllowPaging="true" AllowSelecting="true" ID="gridRequests"
                                                        runat="server" SaveOnCommit="false" PageSize="10" ShowFooter="false" ShowHeader="false"
                                                        GridBorder="None" />
                                                </ContentTemplate>
                                            </asp:UpdatePanel>
                                        </td>
                                        <td style="width: 1px; border-left: 1px solid #dadada">
                                        </td>
                                        <td style="text-align: left; vertical-align: top; border: 1px none black; padding: 2px;">
                                            <asp:UpdatePanel ID="updateContent" runat="server" UpdateMode="Conditional">
                                                <ContentTemplate>
                                                    <div id="divContent" runat="server" visible="false">
                                                        <uc:RequestContent ID="requestContent" runat="server"></uc:RequestContent>
                                                    </div>
                                                    <asp:Button ID="btnLoadByRequestID" runat="server" OnClick="btnLoadByRequestID_OnClick"
                                                        Style="display: none" />
                                                    <asp:HiddenField ID="hidRequestID" runat="server" />
                                                </ContentTemplate>
                                            </asp:UpdatePanel>
                                        </td>
                                    </tr>
                                </table>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </div>
                </asp:Panel>
            </td>
        </tr>
    </table>
</asp:Content>
